package exchange

import (
	"banzhuan/config"
	"banzhuan/rpc"
	"crypto/md5"
	"fmt"
	"log"
	"strconv"
	"time"
)

func EncyMd5(psotData string,class string,method string) []byte {

	timestamp:=time.Now().Unix()
	timestamp_str:=strconv.FormatInt(timestamp,10)

	apiKey,seretKey,_,_:=config.GetConfig()

	encyData:=psotData+seretKey+timestamp_str
	log.Println(encyData)
	data := []byte(encyData)
	has := md5.Sum(data)
	md5Data := fmt.Sprintf("%x", has)
	//log.Println(md5Data)
	log.Println(md5Data,apiKey,seretKey,timestamp_str)
	body:=rpc.HttpAuth(psotData,md5Data,class,method,apiKey,timestamp_str)

	return body

}
